// Copyright (c) 2024 CHANGLEI. All rights reserved.

import 'package:charts_grasp/src/chart/common/segment_properties.dart';
import 'package:flutter/material.dart';

abstract class ChartSegment {
  Paint getFillPaint();

  Paint getStrokePaint();

  void calculateSegmentPoints();

  void onPaint(Canvas canvas);

  Paint? fillPaint;

  Paint? strokePaint;

  late double animationFactor;

  List<Offset> points = <Offset>[];

  int? currentSegmentIndex;

  SegmentProperties? _segmentProperties;

  void dispose() {
    _segmentProperties = null;
  }
}

class SegmentHelper {
  const SegmentHelper._();

  static SegmentProperties getSegmentProperties(ChartSegment chartSegment) => chartSegment._segmentProperties!;

  static void setSegmentProperties(ChartSegment segment, SegmentProperties segmentProperties) =>
      segment._segmentProperties = segmentProperties;
}
